Formal Compiler Implementation in a Logical Framework
نویسندگان
چکیده
The task of designing and implementing a compiler can be a difficult and error-prone process. In this paper, we present a new approach based on the use of higher-order abstract syntax and term rewriting in a logical framework. All program transformations, from parsing to code generation, are cleanly isolated and specified as term rewrites. This has several advantages. The correctness of the compiler depends solely on a small set of rewrite rules that are written in the language of formal mathematics. In addition, the logical framework guarantees the preservation of scoping, and it automates many frequently-occurring tasks including substitution and rewriting strategies. As we show, compiler development in a logical framework can be easier than in a general-purpose language like ML, in part because of automation, and also because the framework provides extensive support for examination, validation, and debugging of the compiler transformations. The paper is organized around a case study, using the MetaPRL logical framework to compile an ML-like language to Intel x86 assembly. We also present a scoped formalization of x86 assembly in which all registers are immutable.
منابع مشابه
Building Extensible Compilers in a Formal Framework A Formal Framework User’s Perspective
We outline a new methodology for compiler design, based on the use of a transformation logic defined within an existing generalpurpose logical framework. We discuss how this methodology can be used to address several central issues in compiler design and implementation: ease of implementation, extensibility, compositionality, and trust. We show how pre-existing features of the logical framework...
متن کاملReliable Frameworks for Extensible Compilers
We present a new methodology for compiler design, based on the use of a transformation logic defined within an existing general-purpose logical framework. We demonstrate how this methodology can be used to address several central issues in compiler design and implementation: ease of implementation, extensibility, compositionality, and trust.
متن کاملFormal compiler construction in a logical framework
The task of designing and implementing a compiler can be a difficult and error-prone process. In this paper, we present a new approach based on the use of higher-order abstract syntax and term rewriting in a logical framework. All program transformations, from parsing to code generation, are cleanly isolated and specified as term rewrites. This has several advantages. The correctness of the com...
متن کاملCode generation from specifications in higher-order logic
A very rigorous weapon against implementation errors in software systems is formal verification: both the desired behaviour (abstract specification) and the implementation (executable specification) are formalised in a suitable logical calculus, and the equivalence of both is proved. The numerous technical details involved in such a procedure suggest to let a proof assistant check all proof ste...
متن کاملBeluga: A Framework for Programming and Reasoning with Deductive Systems
Beluga is an environment for programming and reasoning about formal systems given by axioms and inference rules. It implements the logical framework LF for specifying and prototyping formal systems via higher-order abstract syntax. It also supports reasoning: the user implements inductive proofs about formal systems as dependently typed recursive functions. A distinctive feature of Beluga is th...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2003